home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Libraries / SAT 2.1.2 / HeartQuest sample ƒ / sPoints.p < prev   
Encoding:
Text File  |  1994-06-02  |  1.4 KB  |  58 lines  |  [TEXT/PJMM]

  1. {===============================================}
  2. {================= Point sprite unit ================}
  3. {===============================================}
  4.  
  5. { Example file for Ingemars Sprite Animation Toolkit. }
  6. { © Ingemar Ragnemalm 1992 }
  7. { See doc files for legal terms for using this code. }
  8.  
  9. unit sPoints;
  10.  
  11. { Sprite unit. A Sprite unit should include the following routines:}
  12. { Init-procedure, that initializes private bitmaps}
  13. { Setup-procedure, that sets variables other than the standard ones set by MakeSprite }
  14. { Handle-procedure, to be called once per iteration until the sprite dies }
  15. { Hittask-procedure (optional), for advanced collission handling. }
  16.  
  17. { This object is a non-moving, flashing number, used to indicate that the player}
  18. { has caught a bonus object. }
  19.  
  20. interface
  21.  
  22.     uses
  23.         SAT, GameGlobals;
  24.  
  25.     procedure InitPoints;
  26.     procedure SetupPoints (mp: SpritePtr);
  27.     procedure HandlePoints (me: SpritePtr);
  28.  
  29. implementation
  30.  
  31.     var
  32.         PointsFace, fPointsFace: FacePtr;
  33.  
  34.     procedure InitPoints;
  35.     begin
  36.         fPointsFace := GetFace(132);
  37.         PointsFace := GetFace(131);
  38.     end;
  39.  
  40.     procedure SetupPoints (mp: SpritePtr);
  41.     begin
  42.         mp^.face := PointsFace;
  43.         mp^.task := @HandlePoints;
  44.     end;
  45.  
  46.     procedure HandlePoints (me: SpritePtr);
  47.     begin
  48.         me^.mode := me^.mode + 1;
  49.         if (me^.mode > 32) or (band(me^.mode, 8) = 0) then
  50.             me^.face := PointsFace
  51.         else
  52.             me^.face := fPointsFace;
  53.  
  54.         if me^.mode > 60 then
  55.             me^.task := nil;
  56.     end;
  57.  
  58. end.